/**
 * Created by WT-SUN on 2017/5/31.
 */
/**
 *设计单位查询结果
 * @param data
 */

$(function () {
    var PROJECT_SPECIALTY = CONSTANT.DictionaryTypeDefConstants.PROJECT_SPECIALTY;//项目专业类别PROJECT_SPECIALTY
    var PROJECT_OPERATIONSTATE = CONSTANT.DictionaryTypeDefConstants.PROJECT_OPERATIONSTATE;//项目当前状态
    queryComboData(PROJECT_SPECIALTY, 'querySpecialtye');
    queryComboData(PROJECT_OPERATIONSTATE, 'queryOperationState');
    var arrLevel=[
        {id:"0",text:"一般"},
        {id:"1",text:"较重"},
        {id:"2",text:"严重"}
    ];
    $("#occLevel").combobox({
        data: arrLevel,
        valueField: 'id',
        textField: 'text',
        editable: false,
        panelHeight: '200'
    });
    $("#occLevel1").combobox({
        data: arrLevel,
        valueField: 'id',
        textField: 'text',
        editable: false,
        panelHeight: '200'
    });
    //阶段信息切换事件
    if(occHealthAccept){
        $('#ttH').tabs('select', 2);
    }
    if(occHealthDesign){
        $('#ttH').tabs('select', 1);
    }
    if(occHealthFsd){
        $('#ttH').tabs('select', 0);
    }


    //设计单位，来自承包商
    $('#designerIdName').textbox({
        icons: [{
            iconCls: 'icon-search',
            handler: function () {

            }},{
            iconCls:'icon-remove',
            handler: function(e){
            }
        }]
    });


});


/**
 * 查询下拉列表
 * @param code
 * @param queryId
 */
function queryComboData(code, queryId) {
    var pageId = '#' + queryId;
    $.ajax({
        type: 'post',
        url: ROOT_PATH + '/permission/dictionary/queryDictionaryByDictionaryTypeCode.shtml',
        data: {code: code},
        dataType: "json",
        success: function (result) {
            var multiple;
            //项目专业可多选
            if(queryId=='querySpecialtye'){
                multiple=true;
            }else{
                multiple=false;
            }
            $(pageId).combobox({
                data: result,
                valueField: 'id',
                textField: 'text',
                editable: false,
                panelHeight: '200',
                multiple:multiple,
                hasDownArrow:false
            });
        }
    });
}
